import { http } from "@/utils/http";
import type { PDataRes } from "@/api/response";

export type GenReq = {
  domain: string;
  className: string;
  backAcl: boolean;
  backApi: boolean;
  backEntity: boolean;
  backHttpClient: boolean;
  backHttpRouter: boolean;
  backHttpTest: boolean;
  backRepo: boolean;
  backService: boolean;
  frontApi: boolean;
  frontView: boolean;
  frontViewProvider: boolean;
  force: boolean;
};

export const generateCode = (req: GenReq): Promise<PDataRes> => {
  return http.post("/api/v1/devtools/gen", { data: req });
};
